import instance from './index';
import * as util from "@/assets/util";



//获取权限列表
const request = {
  p: ['get,/permission/hello'],
  r: params => {
    return instance.get(util.baseUrl + `/permission/all`, {headers: {'token':util.session("token")}});
  },
  requestByUsername: params => {
    return instance.get(util.baseUrl +`/user/selectByUsername`, {params:{"username":params},headers: {'token':util.session("token")}});
  }
}
//删除账户
const remove = {
  p: ['delete,/permission/**'],
  r: params => {
    return instance.delete(`/user/delete`,{params:{userId:params},headers:{'token':util.session("token")}})
  }
};

//修改账户
const edit = {
  p: ['put,/permission/**'],
  r: params => {
    return instance.put(`/account/${params.id}`, params)
  }
};
//越权请求
const notAllowed = {
  p: ['get,/permission/notAllowed'],
  r: params => {
    return instance.get(`/roles/notAllowed`, {params})
  }
}

export {
  request,
  remove,
  edit,
  notAllowed
}
